<%@ page import="com.blog.service.BlogService"%>
<%@ page import="com.blog.service.impl.BlogServiceImpl"%>
<%@ page import="com.blog.service.TagService"%>
<%@ page import="com.blog.service.impl.TagServiceImpl"%>
<%@ page import="com.blog.service.UserService"%>
<%@ page import="com.blog.service.impl.UserServiceImpl"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
    TagService tagService=new TagServiceImpl();
    UserService userService=new UserServiceImpl();
    request.setAttribute("rightTag",tagService.selAllTag());


%>
<div class="aside_content" id="aside_content">
	<div class="card-widget card-info">
		<div class="card-content">
			<div class="card-info-avatar is-center">
				<img class="avatar-img" src="${requestScope.right.avatar}"
					onerror="this.onerror=null;this.src='blog/img/friend_404.gif'"
					alt="avatar" />
				<div class="author-info__name">${requestScope.right.name}</div>
				<div class="author-info__description">${requestScope.right.sentence}</div>
			</div>
			<div class="card-info-data">
				<div class="card-info-data-item is-center">
					<a href="blog/archives.jsp">
						<div class="headline">文章</div>
						<div class="length_num">${requestScope.right.blogCount}</div>
					</a>
				</div>
				<div class="card-info-data-item is-center">
					<a href="blog/tags.jsp">
						<div class="headline">标签</div>
						<div class="length_num">${requestScope.right.tagCount}</div>
					</a>
				</div>
				<div class="card-info-data-item is-center">
					<a href="blog/categories.jsp">
						<div class="headline">分类</div>
						<div class="length_num">${requestScope.right.categoryCount}</div>
					</a>
				</div>
			</div>
			<a class="button--animated" id="card-info-btn" target="_blank"
				rel="noopener" href="https://github.com/xxxxxx"><i
				class="fab fa-github"></i><span>关注我</span></a>
			<div class="card-info-social-icons is-center">
				<a class="social-icon" href="https://github.com/xxxxx"
					target="_blank" title="Github"><i class="fab fa-github"></i></a><a
					class="social-icon" href="mailto:xxxxxx@gmail.com" target="_blank"
					title="Email"><i class="fas fa-envelope"></i></a><a
					class="social-icon" href="mailto:xxxxxx@qq.com" target="_blank"
					title="Email"><i class="fab fa-qq"></i></a>
			</div>
		</div>
	</div>
	<div class="card-widget card-announcement">
		<div class="card-content">
			<div class="item-headline">
				<i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span>
			</div>
			<div class="announcement_content">${requestScope.right.notice}</div>
		</div>
	</div>


	<div class="card-widget card-recent-post">
		<div class="card-content">
			<div class="item-headline">
				<i class="fas fa-history"></i><span>最新文章</span>
			</div>
			<div class="aside-list">
				<c:forEach items="${requestScope.right.blogs}" var="blog">
					<div class="aside-list-item ">
						<a class="thumbnail" href="BlogShowServlet?blogID=${blog.id}"
							title="${blog.title}"> <img src="${blog.photo}"
							onerror="this.onerror=null;this.src='blog/img/404.jpg'"
							alt="${blog.title}" /></a>
						<div class="content ">
							<div>
								<a class="title" href="BlogShowServlet?blogID=${blog.id}"
									title="${blog.title}">${blog.title}</a>
							</div>
							<time datetime="2020-09-07T09:26:15.103Z"
								title="发表于 ${blog.uploadTime}">${blog.uploadTime}</time>
						</div>
					</div>
				</c:forEach>
			</div>
		</div>
	</div>


	<div class="card-widget card-categories">
		<div class="card-content">
			<div class="item-headline">
				<i class="fas fa-folder-open"></i><span>分类</span>
			</div>
			<ul class="card-category-list" id="aside-cat-list">

				<ul class="card-category-list child">
					<c:forEach items="${requestScope.right.categories}" var="category"
						begin="0" end="4" step="1">
						<li class="card-category-list-item "><a
							class="card-category-list-link"
							href="blog/detailCategory.jsp?CategoryName=${category.name}"><span
								class="card-category-list-name">${category.name}</span><span
								class="card-category-list-count">${category.count}</span></a></li>
					</c:forEach>
				</ul>
			</ul>
		</div>
	</div>
	<div class="card-widget card-tags">
		<div class="card-content">
			<div class="item-headline">
				<i class="fa fa-tags" aria-hidden="true"></i><span>标签</span>
			</div>
			<div class="card-tag-cloud">

				<c:forEach items="${requestScope.rightTag}" var="tag">
					<a href="blog/detailTag.jsp?tagName=${tag.name}">${tag.name}</a>
				</c:forEach>
			</div>
		</div>
	</div>

</div>

<script src="blog/js/jquery.min.js"></script>
<script>
    function randomColor1(){
        var r = Math.floor(Math.random()*256);
        var g = Math.floor(Math.random()*256);
        var b = Math.floor(Math.random()*256);
        if(r < 16){
            r = "0"+r.toString(16);
        }else{
            r = r.toString(16);
        }
        if(g < 16){
            g = "0"+g.toString(16);
        }else{
            g = g.toString(16);
        }
        if(b < 16){
            b = "0"+b.toString(16);
        }else{
            b = b.toString(16);
        }
        return "#"+r+g+b;
    }


    $(".card-tag-cloud a").each(function () {
        $(this).css("font-size",Math.random() * 10 + 18);
        $(this).css("color",randomColor1());
    })
</script>